﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SerializationDemo
{
    [Serializable]
    public class DethDisease
    {
        private string _name;

        public int Maxage
        {
            get;
            private set;
        }

        public DethDisease(string name, int maxAge)
        {
            this._name = name;
            this.Maxage = maxAge;
        }

        /// <summary>
        /// check whether could live or not
        /// </summary>
        /// <param name="currentAge">the person current age</param>
        /// <param name="medicine">the medicine name the cure the disease</param>
        /// <returns>live or die</returns>
        public bool CanLive(int currentAge, string medicine)
        {
            return Maxage >= currentAge || medicine == _name;
        }
    }
}
